package ch11_多线程与并发;

public class JoinDemo {
	class Counter extends Thread {
		public void run() {
			for (int i = 1; i <= 4; i++) {
				System.out.println("    Counter线程：" + i);
			}
		}
	}

	public static void main(String[] args) {
		Counter c = new JoinDemo().new Counter();
		c.start();
		for (int i = 1; i <= 8; i++) {
			System.out.println("主线程：" + i);
			if (i == 2) {
				try {
					c.join();
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
